Check for root being a GtkWindow in a few places
authorMatthias Clasen <mclasen@redhat.com>
Fri, 30 Apr 2021 17:44:15 +0000 (13:44 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Fri, 30 Apr 2021 17:45:39 +0000 (13:45 -0400)
These things were showing up as crashes during DND,
when the root is a GtkDragIcon. I'm sure there's more.

gtk/gtkwidget.c

index b1411794501ed5b31124f0068aa06d38983a4d82..d4b6ad5191ab2a71a4ecf3920b3f73573f64e1ff 100644 (file)
@@ -7826,7 +7826,7 @@ _gtk_widget_list_devices (GtkWidget *widget,
     }
 
   root = gtk_widget_get_root (widget);
-  if (!root)
+  if (!GTK_IS_WINDOW (root))
     {
       *out_n_devices = 0;
       return NULL;
@@ -12162,7 +12162,7 @@ gtk_widget_set_cursor (GtkWidget *widget,
     return;
 
   root = _gtk_widget_get_root (widget);
-  if (root)
+  if (GTK_IS_WINDOW (root))
     gtk_window_maybe_update_cursor (GTK_WINDOW (root), widget, NULL);
 
   g_object_notify_by_pspec (G_OBJECT (widget), widget_props[PROP_CURSOR]);